﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Management;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    internal class Ab
    {

        public static string A(bool _param0 = false)
        {
            string path1 = AppDomain.CurrentDomain.BaseDirectory + Unk211.e();
            if (!Directory.Exists(path1))
                Directory.CreateDirectory(path1);
            string path2 = path1 + Unk211.Q();
            string str = (string)null;
            if (File.Exists(path2) && !_param0)
            {
                str = File.ReadAllText(path2);
                if (str != Unk211.b())
        {
                    try
                    {
                        return Code211.a(Unk211.q(), str);
                    }
                    catch (Exception ex)
                    {
                        //A.C.A(Unk211.R() + str + Unk211.m() + ex.ToString(), Unk211.b());
                    }
                }
            }
            try
            {
                using (ManagementObjectSearcher managementObjectSearcher = new ManagementObjectSearcher((ObjectQuery)new SelectQuery(Unk211.r())))
                {
                    foreach (ManagementBaseObject managementBaseObject in managementObjectSearcher.Get())
                    {
                        using (managementBaseObject)
                            str = managementBaseObject[Unk211.S()].ToString();
                    }
                }
                if (str == null || str == Unk211.s())
                    str = A_b_C();
                if (!File.Exists(path2))
                    File.WriteAllText(path2, Code211.A(Unk211.q(), str));
                //A.C.A(Unk211.T() + str, Unk211.t());
                return str;
            }
            catch (Exception ex)
            {
                //A.C.A(Unk211.U() + ex.ToString(), Unk211.b());
                return Unk211.u();
            }
        }


        public static string A_b_C()
        {
            try
            {
                string empty = string.Empty;
                foreach (ManagementObject instance in new ManagementClass(Unk211.V()).GetInstances())
                {
                    if ((bool)instance[Unk211.v()])
                        empty = instance[Unk211.W()].ToString();
                }
                return empty;
            }
            catch (Exception ex)
            {
                //A.C.A(Unk211.w() + ex.ToString(), Unk211.b());
                return Unk211.u();
            }
        }

        public static string A_b_a([In] string obj0)
        {
            using (MD5 md5 = MD5.Create())
            {
                byte[] bytes = Encoding.Default.GetBytes(obj0);
                byte[] hash = md5.ComputeHash(bytes);
                StringBuilder stringBuilder = new StringBuilder();
                for (int index = 0; index < hash.Length; ++index)
                    stringBuilder.Append(hash[index].ToString(Unk211.X()));
                return stringBuilder.ToString().ToUpper();
            }
        }
    }
}
